package com.naiterui.ehp.bs.weixin.wechat;

import com.naiterui.ehp.bp.constants.CommonConstant;

import java.util.concurrent.TimeUnit;

/**
 * @author zhoupeipei
 * @date 2019-06-14 15:32
 * @since 1.0.0
 */
public class WeChatCache {
    private static final String ACCESSTOKEN_KEY_PRE = CommonConstant.REDIS_PRE_WECHAT + "ACCESSTOKEN_";
    private static final String ACCESSTOKEN_REFRESH_LOCK_PRE = CommonConstant.REDIS_PRE_WECHAT + "ACCESSTOKEN_LOCK";
    /**
     * accesstoken  缓存有效期   1小时57分钟
     */
    public static final int ACCESS_TOKEN_CACHE_TIME = (int) TimeUnit.MINUTES.toSeconds(117L);

    /**
     * accesstoken 缓存key
     *
     * @param appId
     *
     * @return
     */
    public static String accessTokenKey(String appId) {
        return ACCESSTOKEN_KEY_PRE + appId;
    }

    /**
     * 小程序accessToken
     */
    public static final String ACCESS_TOEKN = "maConfig:accessToken";
}
